<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<title>Insert title here</title>
		<link rel="stylesheet" href="../../resources/layui/css/layui.css" />
	</head>
	<style>
		.over_box {
			position: relative;
		}
		
		.comm {
			position: absolute;
			right: 0;
			bottom: 0px;
		}
	</style>

	<body>
		<form action="" method="post" class="article_comment">
			<textarea id="area" name="comment" style="display: none;"></textarea>
			<div class="over_box">
				<input type="button" name="" id="pl" class="layui-btn layui-btn-normal comm" lay-submit="" lay-filter="pl"  value="评论" />
			</div>
		</form>

	</body>
	<script type="text/javascript" src="../../resources/js/jquery-1.11.1.min.js"></script>
	<script type="text/javascript" src="../../resources/layui/layui.all.js"></script>
	<script>
		var layedit = layui.layedit;
		var index = layedit.build('area', {
			tool: ['left', 'center', 'right', '|', 'face'],
			height: 140
		});
		$("#pl").on('click', function() {
			var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
			parent.layer.close(index); //再执行关闭
		});
		layui.use('form', function() {
			var form = layui.form;
			form.on('submit(pl)', function() {
				var content = layedit.getText(index);
				console.log(content);
				alert(content);
			});
		});
	</script>

</html>